home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 3 / Info_Mac_1994-01.iso / Development / Source / Shutdown FX 1.3 Source / Shutdown FX ƒ / sfx wipes ƒ / Circular wipe.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-14  |  3.2 KB  |  140 lines  |  [TEXT/KAHL]

  1. /**********************************************************************\
  2.  
  3. File:        Circular wipe.c
  4.  
  5. Purpose:    This module handles clearing the screen in a funky
  6.             manner.  See the comments below for more details.
  7.             
  8.  
  9. Shutdown FX -=- graphic effects on shutdown
  10. Copyright (C) 1993 Mark Pilgrim & Dave Blumenthal
  11.  
  12. This program is free software; you can redistribute it and/or modify
  13. it under the terms of the GNU General Public License as published by
  14. the Free Software Foundation; either version 2 of the License, or
  15. (at your option) any later version.
  16.  
  17. This program is distributed in the hope that it will be useful,
  18. but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20. GNU General Public License for more details.
  21.  
  22. You should have received a copy of the GNU General Public License
  23. along with this program in a file named "GNU General Public License".
  24. If not, write to the Free Software Foundation, 675 Mass Ave,
  25. Cambridge, MA 02139, USA.
  26.  
  27. \**********************************************************************/
  28.  
  29. #include "msg timing.h"
  30.  
  31. #define BlockSize 17
  32. #define CorrectTime 2
  33.  
  34. void CircularWipe(Pattern *thePattern, int width, int height);
  35.  
  36. /* Trace a region from the center to the topleft corner, over <BlockSize> pixels,
  37.    and back to the center.  Fill that in and move the region parameters +BlockSize.
  38.    Repeat for all sides. */
  39.  
  40. void CircularWipe(Pattern *thePattern, int width, int height)
  41. {
  42.     RgnHandle    curregion;
  43.     Rect        source;
  44.     int            cx,cy,gap,lastx,lasty;
  45.     
  46.     cx = width / 2;
  47.     cy = height / 2;
  48.     
  49.     curregion=NewRgn();
  50.     source.top=source.left=0;
  51.     source.bottom=height;
  52.     source.right=width;
  53.     
  54.     gap=BlockSize;
  55.     lastx=0;
  56.     do                                            /* top quadrant */
  57.     {
  58.         StartTiming();
  59.         SetEmptyRgn(curregion);
  60.         MoveTo(cx,cy);
  61.         OpenRgn();
  62.             LineTo(lastx,0);
  63.             LineTo(gap,0);
  64.             LineTo(cx,cy);
  65.         CloseRgn(curregion);
  66.  
  67.         FillRgn(curregion, *thePattern);
  68.         
  69.         lastx=gap;
  70.         gap+=BlockSize;
  71.         TimeCorrection(CorrectTime);
  72.     }
  73.     while (gap<width+BlockSize);
  74.     
  75.     gap=BlockSize;
  76.     lasty=0;
  77.     do                                            /* right quadrant */
  78.     {
  79.         StartTiming();
  80.         SetEmptyRgn(curregion);
  81.         MoveTo(cx,cy);
  82.         OpenRgn();
  83.             LineTo(width,lasty);
  84.             LineTo(width,gap);
  85.             LineTo(cx,cy);
  86.         CloseRgn(curregion);
  87.  
  88.         FillRgn(curregion, *thePattern);
  89.         
  90.         lasty=gap;
  91.         gap+=BlockSize;
  92.         TimeCorrection(CorrectTime);
  93.     }
  94.     while (gap<height+BlockSize);
  95.     
  96.     lastx=width;
  97.     gap=width-BlockSize;
  98.     do                                            /* bottom quadrant */
  99.     {
  100.         StartTiming();
  101.         SetEmptyRgn(curregion);
  102.         MoveTo(cx,cy);
  103.         OpenRgn();
  104.             LineTo(lastx,height);
  105.             LineTo(gap,height);
  106.             LineTo(cx,cy);
  107.         CloseRgn(curregion);
  108.  
  109.         FillRgn(curregion, *thePattern);
  110.         
  111.         lastx=gap;
  112.         gap-=BlockSize;
  113.         TimeCorrection(CorrectTime);
  114.     }
  115.     while (gap>-BlockSize);
  116.     
  117.     lasty=height;
  118.     gap=height-BlockSize;
  119.     do                                            /* left quadrant */
  120.     {
  121.         StartTiming();
  122.         SetEmptyRgn(curregion);
  123.         MoveTo(cx,cy);
  124.         OpenRgn();
  125.             LineTo(0,lasty);
  126.             LineTo(0,gap);
  127.             LineTo(cx,cy);
  128.         CloseRgn(curregion);
  129.  
  130.         FillRgn(curregion, *thePattern);
  131.         
  132.         lastx=gap;
  133.         gap-=BlockSize;
  134.         TimeCorrection(CorrectTime);
  135.     }
  136.     while (gap>-BlockSize);
  137.     
  138.     DisposeRgn(curregion);
  139. }
  140.